/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.bitoon.basketdudes.jpa;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author paco
 */
@Entity
@Table(name = "m_jugador_trait")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "MJugadorTrait.findAll", query = "SELECT m FROM MJugadorTrait m"),
    @NamedQuery(name = "MJugadorTrait.findById", query = "SELECT m FROM MJugadorTrait m WHERE m.id = :id"),
    @NamedQuery(name = "MJugadorTrait.findByMJugador", 
        query = "SELECT m FROM MJugadorTrait m WHERE m.traitId = :trait_id and m.MJugadorId=:m_jugador_id")
})
public class MJugadorTrait implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;
    
//    @JoinColumn(name = "trait_id", referencedColumnName = "id")
//    @ManyToOne(optional = false)
    @Column(name = "trait_id")
    private short traitId;

//    @JoinColumn(name = "m_jugador_id", referencedColumnName = "id")
//    @ManyToOne(optional = false)
    @Column(name = "m_jugador_id")
    private short MJugadorId;
    
    
    public MJugadorTrait() {
    }

    public MJugadorTrait(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public short getTraitId() {
        return traitId;
    }

    public void setTraitId(short traitId) {
        this.traitId = traitId;
    }

    public short getMJugadorId() {
        return MJugadorId;
    }

    public void setMJugadorId(short valor) {
        this.MJugadorId = valor;
    }
    
    
    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof MJugadorTrait)) {
            return false;
        }
        MJugadorTrait other = (MJugadorTrait) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.bitoon.basketdudes.jpa.MJugadorTrait[ id=" + id + " ]";
    }
    
}
